package com.gitee.hermer.engine.jars.dependent.activemq.configuration;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.sql.DataSource;

import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportAware;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.annotation.Order;
import org.springframework.core.type.AnnotationMetadata;

import com.gitee.hermer.boot.jee.commons.bean.utils.BeanLocator;
import com.gitee.hermer.boot.jee.commons.collection.CollectionUtils;
import com.gitee.hermer.boot.jee.commons.log.UtilsContext;
import com.gitee.hermer.engine.jars.core.domain.EngineConstant;
import com.gitee.hermer.engine.jars.dependent.activemq.config.ActiveMQProperties;
import com.gitee.hermer.engine.jars.dependent.activemq.core.ActiveMQCluster;
import com.gitee.hermer.engine.jars.dependent.activemq.core.ActiveMQContext;
import com.gitee.hermer.engine.jars.dependent.activemq.core.ActiveMQManager;
import com.gitee.hermer.engine.jars.dependent.activemq.core.pool.ActiveMQSessionPoolFactory;



@Configuration
public class ActiveMQAutoConfiguration implements Ordered{
	
	@Bean
	public ActiveMQProperties activeMQProperties(){
		return new ActiveMQProperties();
	}
	
	@Bean
	@Order(0)
	public ActiveMQCluster activeMQCluster(ActiveMQProperties properties){
		return new ActiveMQCluster(properties.getBrokers());
	}
	
	@Bean
	@Order(1)
	public ActiveMQManager activeMQManager(ActiveMQCluster cluster){
		return new ActiveMQManager(cluster);
	}
	
	@Bean
	@Order(2)
	public ActiveMQContext activeMQContext(ActiveMQProperties properties){
		return new ActiveMQContext(properties);
	}
	
	
	@Override
	public int getOrder() {
		return HIGHEST_PRECEDENCE+200;
	}

	
}
